package com.qiezikaka.kaka.ui;

import android.app.Activity;

import com.qiezikaka.kaka.base.BasePresenter;
import com.qiezikaka.kaka.bean.AllBean;
import com.qiezikaka.kaka.bean.ShopInfo;
import com.qiezikaka.kaka.net.DataManager;
import com.qiezikaka.kaka.ui.bind.BindStoreContract;

import rx.Subscription;
import rx.functions.Action1;

public class StyleChoiceAllPresenter extends BasePresenter<StyleChoiceAllContract.View> implements StyleChoiceAllContract.Presenter {

    public StyleChoiceAllPresenter(Activity activity, StyleChoiceAllContract.View view) {
        super(activity, view);

    }


    /**
     * 是否绑定设备
     * @param address
     */
    @Override
    public void isBind(String address) {
        Subscription subscribe = DataManager.getInstance().getIsBind(address)
                .subscribe(new Action1<AllBean>() {
                    @Override
                    public void call(AllBean InfoData) {
                        if (InfoData != null) {
                            mView.onIsBind(InfoData);
                        }
                    }
                }, new Action1<Throwable>() {
                    @Override
                    public void call(Throwable throwable) {
                        throwable.printStackTrace();
                        mView.onFailer(throwable);
                    }
                });
        addSubscribe(subscribe);
    }
}
